package com.nan.hrm.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.nan.hrm.domain.CourseResource;
import com.nan.hrm.mapper.CourseResourceMapper;
import com.nan.hrm.query.CourseResourceQuery;
import com.nan.hrm.service.ICourseResourceService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.nan.hrm.util.PageList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author N
 * @since 2021-09-14
 */
@Service
public class CourseResourceServiceImpl extends ServiceImpl<CourseResourceMapper, CourseResource> implements ICourseResourceService {

    @Autowired
    private CourseResourceMapper courseResourceMapper;
    @Override
    public PageList<CourseResource> selectPageList(CourseResourceQuery query) {
        Page<CourseResource> page = new Page<>(query.getPage(), query.getRows());
        //联表查询
        List<CourseResource> datas = courseResourceMapper.selectPageList(page,query);
        return new PageList<>(page.getTotal(),datas);
    }
}
